var app=getApp();
Page({
    data: {
        __PUBLIC__:app.__PUBLIC__ ,
        list: [
            {
                id: 'record',
                name: '车辆档案',
                open: false,
                pages: ['车辆列表','添加车辆','车机升级','品牌列表'],
                pagesUrl: ['cars/list/list','cars/add/add','cars/machineUpgrade/list/list','cars/brand/list/list'],
                imgUrls: 'images/record.png'
            },
            {
                id: 'manage',
                name: '车主管理',
                open: false,
                pages: ['所属公司','添加公司','个人车主','添加车主'],
                pagesUrl: ['manage/company/list/list','manage/company/add/add','manage/personal/list/list','manage/personal/add/add'],
                imgUrls:'images/manage.png'
            },
            {
                id: 'join',
                name: '加盟管理',
                open: false,
                pages: ['加盟商列表','加盟商添加'],
                pagesUrl: ['agency/list/list','agency/add/add'],
                imgUrls:'images/join.png'
            },
            {
                id: 'agreement',
                name: '租用记录',
                open: false,
                pages: ['租赁列表','租赁添加'],
                pagesUrl: ['rent/list/list','rent/add/add'],
                imgUrls:'images/agreement.png'
            },
            {
                id: 'maintain',
                name: '车辆维护',
                open: false,
                pages: ['维修列表','维修添加','保养列表','保养添加','年检列表','年检添加'],
                pagesUrl: ['repair/list/list','repair/add/add','maintain/list/list','maintain/add/add',
                           'inspect/list/list','inspect/add/add'],
                imgUrls:'images/maintain.png'
            },
            {
                id: 'insure',
                name: '车辆投保',
                open: false,
                pages: ['投保列表','投保添加'],
                pagesUrl: ['secure/list/list','secure/add/add'],
                imgUrls:'images/insure.png'
            },
            {
                id: 'taxes',
                name: '车辆税费',
                open: false,
                pages: ['税费列表','税费添加'],
                pagesUrl: ['taxes/list/list','taxes/add/add'],
                imgUrls:'images/taxes.png'
            },
            {
                id: 'administrator',
                name: '管理员管理',
                open: false,
                pages: ['管理员列表','管理员添加'],
                pagesUrl: ['admin/list/list','admin/add/add'],
                imgUrls:'images/administrator.png'
            },
            // {
            //     id: 'count',
            //     name: '数据统计',
            //     open: false,
            //     pages: [],
            //     pagesUrl: [],
            //     imgUrls:'images/count.png'
            // },
            {
                id: 'other',
                name: '其他选项',
                open: false,
                pages: ['费用列表','费用添加'],
                pagesUrl: ['fees/list/list','fees/add/add'],
                imgUrls:'images/other.png'
            },
        ],    
    },
    kindToggle: function (e) {
        var id = e.currentTarget.id, list = this.data.list;
        for (var i = 0, len = list.length; i < len; ++i) {
            if (list[i].id == id) {
                list[i].open = !list[i].open
            } else {
                list[i].open = false;
            }
        }
        this.setData({
            list: list
        });
    }
});
